float4x4 gWorld : WORLD;
float4x4 gViewProjection : VIEWPROJECTION;

textureCUBE gDiffuseTexture : DIFFUSE;

samplerCUBE gDiffuseSampler = sampler_state 
{
    Texture = <gDiffuseTexture>;
    FILTER = MIN_MAG_MIP_LINEAR;
    AddressU = Wrap;
    AddressV = Wrap;
};


struct VERTEX_INPUT
{
    float3 pos	: POSITION0;
	float3 uvw	: TEXCOORD0;
};

struct PIXEL_INPUT
{
    float4 pos	: POSITION0;
	float3 uvw	: TEXCOORD0;
};

PIXEL_INPUT VertShader(VERTEX_INPUT input)
{
	// The pixel data
	PIXEL_INPUT output;

	// Move position to world space
	float4 worldloc = mul(float4(input.pos, 1.0f), gWorld);
	output.pos = mul(worldloc, gViewProjection).xyww;
	
	// Send texture coords
	output.uvw = input.pos;

	// Send to pixel shader
	return output; 
}

float4 FragmentShader(PIXEL_INPUT input) : COLOR
{
	// Return texture color using normals
	return texCUBE(gDiffuseSampler, input.uvw);
}

technique myTechnique
{
	pass p0 
	{
        vertexShader = compile vs_2_0 VertShader();
        pixelShader  = compile ps_2_0 FragmentShader();
		ZEnable = FALSE;
		CullMode = None;
	}
}
